<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="trainSearch" styleClass="edit">

        <rich:simpleTogglePanel label="Reservation" switchType="ajax">

            
            
            <s:decorate template="layout/display.xhtml">
            
            <ui:define name="label">Gare depart</ui:define>
           
           <rich:comboBox  value="#{bean.state}" suggestionValues="#{bean.suggestions}" directInputSuggestions="true" defaultLabel="Selectionner gare...">
        		<f:selectItem itemValue="Tunis"/>            
       			<f:selectItem itemValue="Sousse"/>
       			<f:selectItem itemValue="Bizerte"/>
       			<f:selectItem itemValue="Nabeul"/>
			</rich:comboBox>            
             </s:decorate>
             
              <s:decorate template="layout/display.xhtml">
            
            <ui:define name="label">Gare Arrive</ui:define>
           
           <rich:comboBox  value="#{bean.state}" suggestionValues="#{bean.suggestions}" directInputSuggestions="true" defaultLabel="Selectionner gare...">
        		<f:selectItem itemValue="Tunis"/>            
       			<f:selectItem itemValue="Sousse"/>
       			<f:selectItem itemValue="Bizerte"/>
       			<f:selectItem itemValue="Nabeul"/>
			</rich:comboBox>            
             </s:decorate>
			
			<s:decorate template="/layout/display.xhtml"/>
            
			 <s:decorate id="dateReservationField" template="layout/edit.xhtml">
			 
                <ui:define name="label">Date reservation</ui:define>
                <rich:calendar id="dateReservation"
                          value="#{reservationHome.instance.dateReservation}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>
            
             <s:decorate id="dateReservationField2" template="layout/edit.xhtml">
                <ui:define name="label">Date reservation</ui:define>
                <rich:calendar id="dateReservation"
                          value="#{reservationHome.instance.dateReservation}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>

			

        </rich:simpleTogglePanel>

        <div class="actionButtons">
            <h:commandButton id="search" value="Rechercher" action="/TrainList.xhtml"/>
            <s:button id="reset" value="Annuler" includePageParams="false"/>
          	
        </div>

    </h:form>

    <rich:panel>
        <f:facet name="header">Train Search Results (#{empty trainList.resultList ? 0 : (trainList.paginated ? trainList.resultCount : trainList.resultList.size)})</f:facet>
    <div class="results" id="trainList">

    <h:outputText value="The train search returned no results."
               rendered="#{empty trainList.resultList}"/>

    <rich:dataTable id="trainList"
                var="_train"
              value="#{trainList.resultList}"
           rendered="#{not empty trainList.resultList}">
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{trainList}"/>
                    <ui:param name="propertyLabel" value="Idtrain"/>
                    <ui:param name="propertyPath" value="train.idtrain"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_train.idtrain}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{trainList}"/>
                    <ui:param name="propertyLabel" value="Type"/>
                    <ui:param name="propertyPath" value="train.type"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_train.type}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{trainList}"/>
                    <ui:param name="propertyLabel" value="Place"/>
                    <ui:param name="propertyPath" value="train.place"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_train.place}"/>
        </h:column>
        <rich:column styleClass="action">
            <f:facet name="header">Action</f:facet>
            <s:link view="/#{empty from ? 'Train' : from}.xhtml"
                   value="#{empty from ? 'View' : 'Select'}"
             propagation="#{empty from ? 'none' : 'default'}"
                      id="trainViewId">
                <f:param name="trainIdtrain"
                        value="#{_train.idtrain}"/>
            </s:link>
           
        </rich:column>
    </rich:dataTable>

    </div>
    </rich:panel>

    <div class="tableControl">

        <s:link view="/TrainList.xhtml"
            rendered="#{trainList.previousExists}"
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>

        <s:link view="/TrainList.xhtml"
            rendered="#{trainList.previousExists}"
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult"
                    value="#{trainList.previousFirstResult}"/>
        </s:link>

        <s:link view="/TrainList.xhtml"
            rendered="#{trainList.nextExists}"
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult"
                    value="#{trainList.nextFirstResult}"/>
        </s:link>

        <s:link view="/TrainList.xhtml"
            rendered="#{trainList.nextExists}"
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult"
                    value="#{trainList.lastFirstResult}"/>
        </s:link>

    </div>

    <s:div styleClass="actionButtons" rendered="#{empty from}">

    </s:div>

</ui:define>

</ui:composition>
